# exts.py ：插件管理
# 扩展第三方插件


# 导入第三方插件
from flask_sqlalchemy import SQLAlchemy
from flask_migrate import Migrate
from flask_socketio import SocketIO

# 初始化
db: SQLAlchemy = SQLAlchemy()  # ORM
migrate = Migrate()  # 数据迁移

soc = SocketIO(cors_allowed_origins="*")


def create_socketio_instance(app):
    soc.init_app(app=app)
    return soc


# 和app对象绑定
def init_exts(app):
    db.init_app(app=app)
    migrate.init_app(app=app, db=db)
    soc.init_app(app=app)
